/**
 * 
 */
package org.xlab.baseframework.conf;

import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.xlab.baseframework.service.api.ISystemCodeService;
import org.xlab.baseframework.service.api.ISystemLogService;
import org.xlab.baseframework.service.api.ISystemMailService;
import org.xlab.baseframework.service.api.ISystemMessageService;
import org.xlab.baseframework.service.api.ISystemParameterService;
import org.xlab.baseframework.service.api.ISystemWebServiceSessionService;
import org.xlab.baseframework.service.impl.DefaultUserServiceImpl;
import org.xlab.baseframework.service.impl.SystemCodeServiceImpl;
import org.xlab.baseframework.service.impl.SystemLogServiceImpl;
import org.xlab.baseframework.service.impl.SystemMailServiceImpl;
import org.xlab.baseframework.service.impl.SystemMessageServiceImpl;
import org.xlab.baseframework.service.impl.SystemParameterServiceImpl;
import org.xlab.baseframework.service.impl.SystemWebServiceSessionServiceImpl;
import org.xlab.baseframework.service.spi.IUserService;

/**
 * @author MaKuBEX
 * 
 */
@Configuration
public class ServiceConfiguration {
	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemCodeServiceMessageSource")
	@Qualifier("bpf_systemCodeServiceMessageSource")
	public MessageSource bpfSystemCodeServiceMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(
				"org/xlab/baseframework/i18n/systemCodeService",
				"org/xlab/baseframework/i18n/systemParameterNotFoundException",
				"org/xlab/baseframework/i18n/systemRuntimeException");
		return messageSource;
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemLogServiceMessageSource")
	@Qualifier("bpf_systemLogServiceMessageSource")
	public MessageSource bpfSystemLogServiceMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(
				"org/xlab/baseframework/i18n/systemLogService",
				"org/xlab/baseframework/i18n/systemRuntimeException");
		return messageSource;
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemParameterServiceMessageSource")
	@Qualifier("bpf_systemParameterServiceMessageSource")
	public MessageSource bpfSystemParameterServiceMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(
				"org/xlab/baseframework/i18n/systemParameterService",
				"org/xlab/baseframework/i18n/systemParameterNotFoundException",
				"org/xlab/baseframework/i18n/permissDeniedException",
				"org/xlab/baseframework/i18n/systemRuntimeException");
		return messageSource;
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemWSServiceMessageSource")
	@Qualifier("bpf_systemWSServiceMessageSource")
	public MessageSource bpfSystemWSServiceMessageSource() {
		ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
		messageSource.setBasenames(
				"org/xlab/baseframework/i18n/systemWebServiceSessionService",
				"org/xlab/baseframework/i18n/systemRuntimeException");
		return messageSource;
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_defaultUserService")
	public IUserService defaultUserService() {
		return new DefaultUserServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemCodeService")
	public ISystemCodeService systemCodeService() {
		return new SystemCodeServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemLogService")
	public ISystemLogService systemLogService() {
		return new SystemLogServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemMailService")
	public ISystemMailService systemMailService() {
		return new SystemMailServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemMessageService")
	public ISystemMessageService systemMessageService() {
		return new SystemMessageServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemParameterService")
	public ISystemParameterService systemParameterService() {
		return new SystemParameterServiceImpl();
	}

	@Bean(autowire = Autowire.BY_NAME, name = "bpf_systemWSSessionService")
	public ISystemWebServiceSessionService systemWebServiceSessionService() {
		return new SystemWebServiceSessionServiceImpl();
	}

}
